/*
Copyright (C) 2008-2011 ForceMem (Siarhei Fedarenko)
GNU General Public License version 3 (GPLv3)
 */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;

namespace TranscriptionWriter
{
    static class Program
    {
        public static bool IsNiceOSForSimpleButton
        {
            get {
                //Get Operating system information.
                OperatingSystem os = Environment.OSVersion;
                //Get version information about the os.
                Version vs = os.Version;

                return (os.Platform == PlatformID.Win32NT) && (vs.Major == 6);
            }
        }

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {

            Mutex mutex = null;
            bool owned = false;
            try
            {
                mutex = new System.Threading.Mutex(true, System.Reflection.Assembly.GetExecutingAssembly().FullName, out owned);
                if (owned)
                {
                }
                else
                {
                    Mutex.OpenExisting(System.Reflection.Assembly.GetExecutingAssembly().FullName);
                    MessageBox.Show("Another instance already running.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }
            }
            finally
            {
                if (mutex != null && owned)
                    mutex.ReleaseMutex();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}